
 #include<stdio.h>
 #include<math.h>
 
  main()
  {
	
	int n,k, n_k;
	long double Act_val,Cal_val,Round_off_err;
	float Cal(int n,int k);
	printf("\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Maths Assignment~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
	printf("\nGroup Member :   SUYOG KUVAR and SANDIP KARALE. ");
	printf("\nAssignment Title :  Roundoff Error. \n");
	printf("\nPlease enter the value of n : ");
	scanf("%d",&n);
	printf("\nPlease enter the value of k : ");
	scanf("%d",&k);
	n_k = n - k ;
	Act_val = pow(10,n_k) ;
	
	Cal_val = Cal(n,k);
	printf("\nActual value value = %LF",Act_val);
	printf("\ncalculated value = %LF",Cal_val);
	Round_off_err = (long double)(Cal_val - Act_val) ;
	if(Round_off_err<0)
	Round_off_err = Round_off_err * -1;
	printf("\nRound off error = %LF\n",Round_off_err);
	return 0 ;
	
  }

	long double Cal(int n,int k)
	{
		long double kans=1,nans,kans_rec,final_ans,fans;
		int i,j;
		printf("\n n = %d , k = %d ",n,k);

		for(i=0 ; i < k ; i++)
		{
			// calculate 10^k
			kans = kans * 10 ;
		}
		printf("\nkans = %LF",kans);
		kans_rec =(long double) 1 / (long double) kans ;
		printf("\nkans_rec = %.25LF",kans_rec);
		final_ans = kans_rec;
		for(j = 0 ; j < n ; j++)
		{
			final_ans = 10 * (float)final_ans ;
		}
		return final_ans;
	}
	
